﻿using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;
using Pomelo.EntityFrameworkCore.MySql.Scaffolding.Internal;

namespace UtilsORM.MySqlData;

public partial class yihongIotContext : DbContext
{
    public yihongIotContext()
    {
    }

    public yihongIotContext(DbContextOptions<yihongIotContext> options)
        : base(options)
    {
    }

    public virtual DbSet<bs_client> bs_client { get; set; }

    public virtual DbSet<bs_client_department> bs_client_department { get; set; }

    public virtual DbSet<bs_client_level> bs_client_level { get; set; }

    public virtual DbSet<bs_client_module> bs_client_module { get; set; }

    public virtual DbSet<bs_client_post> bs_client_post { get; set; }

    public virtual DbSet<bs_client_product_bak> bs_client_product_bak { get; set; }

    public virtual DbSet<bs_client_role> bs_client_role { get; set; }

    public virtual DbSet<bs_client_role_menu> bs_client_role_menu { get; set; }

    public virtual DbSet<bs_client_role_power> bs_client_role_power { get; set; }

    public virtual DbSet<bs_client_system_log> bs_client_system_log { get; set; }

    public virtual DbSet<bs_client_user> bs_client_user { get; set; }

    public virtual DbSet<bs_client_user_dep> bs_client_user_dep { get; set; }

    public virtual DbSet<bs_client_user_role> bs_client_user_role { get; set; }

    public virtual DbSet<bs_language> bs_language { get; set; }

    public virtual DbSet<bs_language_config> bs_language_config { get; set; }

    public virtual DbSet<bs_language_config_item> bs_language_config_item { get; set; }

    public virtual DbSet<bs_language_iot_product> bs_language_iot_product { get; set; }

    public virtual DbSet<bs_language_iot_product_item> bs_language_iot_product_item { get; set; }

    public virtual DbSet<bs_language_product_alone> bs_language_product_alone { get; set; }

    public virtual DbSet<bs_language_product_item_alone> bs_language_product_item_alone { get; set; }

    public virtual DbSet<bs_manage_role> bs_manage_role { get; set; }

    public virtual DbSet<bs_manage_role_menu> bs_manage_role_menu { get; set; }

    public virtual DbSet<bs_manage_role_power> bs_manage_role_power { get; set; }

    public virtual DbSet<bs_manage_system_log> bs_manage_system_log { get; set; }

    public virtual DbSet<bs_manage_system_menu> bs_manage_system_menu { get; set; }

    public virtual DbSet<bs_manage_system_module> bs_manage_system_module { get; set; }

    public virtual DbSet<bs_manage_user_role> bs_manage_user_role { get; set; }

    public virtual DbSet<bs_system_config> bs_system_config { get; set; }

    public virtual DbSet<bs_system_oauth_access_token> bs_system_oauth_access_token { get; set; }

    public virtual DbSet<bs_system_oauth_client> bs_system_oauth_client { get; set; }

    public virtual DbSet<bs_system_oauth_grant> bs_system_oauth_grant { get; set; }

    public virtual DbSet<bs_system_oauth_refresh_token> bs_system_oauth_refresh_token { get; set; }

    public virtual DbSet<iot_device> iot_device { get; set; }

    public virtual DbSet<iot_device_agreement> iot_device_agreement { get; set; }

    public virtual DbSet<iot_device_camera> iot_device_camera { get; set; }

    public virtual DbSet<iot_device_command> iot_device_command { get; set; }

    public virtual DbSet<iot_device_command_haddleing> iot_device_command_haddleing { get; set; }

    public virtual DbSet<iot_device_command_log> iot_device_command_log { get; set; }

    public virtual DbSet<iot_device_command_processing> iot_device_command_processing { get; set; }

    public virtual DbSet<iot_device_gateway> iot_device_gateway { get; set; }

    public virtual DbSet<iot_device_group> iot_device_group { get; set; }

    public virtual DbSet<iot_device_linkage> iot_device_linkage { get; set; }

    public virtual DbSet<iot_device_linkage_condition> iot_device_linkage_condition { get; set; }

    public virtual DbSet<iot_device_linkage_condition_handle> iot_device_linkage_condition_handle { get; set; }

    public virtual DbSet<iot_device_linkage_condition_log> iot_device_linkage_condition_log { get; set; }

    public virtual DbSet<iot_device_linkage_condition_model_support> iot_device_linkage_condition_model_support { get; set; }

    public virtual DbSet<iot_device_linkage_execute_record> iot_device_linkage_execute_record { get; set; }

    public virtual DbSet<iot_device_live_state> iot_device_live_state { get; set; }

    public virtual DbSet<iot_device_logo> iot_device_logo { get; set; }

    public virtual DbSet<iot_device_minimachinecommand_log> iot_device_minimachinecommand_log { get; set; }

    public virtual DbSet<iot_device_model> iot_device_model { get; set; }

    public virtual DbSet<iot_device_model_file> iot_device_model_file { get; set; }

    public virtual DbSet<iot_device_model_type> iot_device_model_type { get; set; }

    public virtual DbSet<iot_device_model_variable> iot_device_model_variable { get; set; }

    public virtual DbSet<iot_device_model_variable_relation> iot_device_model_variable_relation { get; set; }

    public virtual DbSet<iot_device_model_variable_value_rlue> iot_device_model_variable_value_rlue { get; set; }

    public virtual DbSet<iot_device_software> iot_device_software { get; set; }

    public virtual DbSet<iot_device_software_publish> iot_device_software_publish { get; set; }

    public virtual DbSet<iot_device_task_default_run> iot_device_task_default_run { get; set; }

    public virtual DbSet<iot_device_task_plain> iot_device_task_plain { get; set; }

    public virtual DbSet<iot_device_task_plain_item> iot_device_task_plain_item { get; set; }

    public virtual DbSet<iot_device_task_plain_item_handle> iot_device_task_plain_item_handle { get; set; }

    public virtual DbSet<iot_device_task_plain_item_log> iot_device_task_plain_item_log { get; set; }

    public virtual DbSet<iot_device_task_plain_log> iot_device_task_plain_log { get; set; }

    public virtual DbSet<iot_device_task_time_fixed> iot_device_task_time_fixed { get; set; }

    public virtual DbSet<iot_device_task_time_fixed_log> iot_device_task_time_fixed_log { get; set; }

    public virtual DbSet<iot_device_task_time_interval> iot_device_task_time_interval { get; set; }

    public virtual DbSet<iot_device_task_time_interval_log> iot_device_task_time_interval_log { get; set; }

    public virtual DbSet<iot_device_value_current> iot_device_value_current { get; set; }

    public virtual DbSet<iot_device_value_log> iot_device_value_log { get; set; }

    public virtual DbSet<iot_mq_client> iot_mq_client { get; set; }

    public virtual DbSet<iot_mq_log> iot_mq_log { get; set; }

    public virtual DbSet<iot_product> iot_product { get; set; }

    public virtual DbSet<iot_product_model> iot_product_model { get; set; }

    public virtual DbSet<iot_product_state> iot_product_state { get; set; }

    public virtual DbSet<iot_system_error_log> iot_system_error_log { get; set; }

    public virtual DbSet<iot_warn_log> iot_warn_log { get; set; }

    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see https://go.microsoft.com/fwlink/?LinkId=723263.
        => optionsBuilder.UseMySql("server=10.0.1.16;port=3306;database=yihongIOT;uid=admin;pwd=123456;sslmode=none;allowpublickeyretrieval=True", Microsoft.EntityFrameworkCore.ServerVersion.Parse("8.0.40-mysql"));

    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder
            .UseCollation("utf8mb4_general_ci")
            .HasCharSet("utf8mb4");

        modelBuilder.Entity<bs_client>(entity =>
        {
            entity.HasKey(e => e.c_id).HasName("PRIMARY");

            entity.Property(e => e.c_power_type).HasComment("operator运营,general普通");
            entity.Property(e => e.c_status).HasDefaultValueSql("'0'");
        });

        modelBuilder.Entity<bs_client_department>(entity =>
        {
            entity.HasKey(e => e.dep_id).HasName("PRIMARY");

            entity.Property(e => e.dep_cpy_guid).HasComment("对应pm_company");
            entity.Property(e => e.dep_status).HasComment("0有效，1无效");
            entity.Property(e => e.dep_type).HasComment("1项目部门，2职能部门");
        });

        modelBuilder.Entity<bs_client_level>(entity =>
        {
            entity.HasKey(e => e.L_AutoID).HasName("PRIMARY");
        });

        modelBuilder.Entity<bs_client_module>(entity =>
        {
            entity.HasKey(e => e.cm_autoid).HasName("PRIMARY");

            entity.Property(e => e.cm_autoid).ValueGeneratedNever();
        });

        modelBuilder.Entity<bs_client_post>(entity =>
        {
            entity.HasKey(e => e.P_AutoID).HasName("PRIMARY");

            entity.Property(e => e.P_IsValid).HasComment("1有效，-1无效");
        });

        modelBuilder.Entity<bs_client_product_bak>(entity =>
        {
            entity.HasKey(e => e.cp_id).HasName("PRIMARY");

            entity.Property(e => e.cp_c_guid).HasComment("客户ID");
            entity.Property(e => e.cp_ip).HasComment("远程IP地址");
            entity.Property(e => e.cp_name).HasComment("产品名称");
            entity.Property(e => e.cp_product_guid).HasComment("产品ID");
            entity.Property(e => e.cp_status)
                .HasDefaultValueSql("'0'")
                .HasComment("0有效，1无效");
            entity.Property(e => e.cp_systemcode).HasComment("系统编码");
        });

        modelBuilder.Entity<bs_client_role>(entity =>
        {
            entity.HasKey(e => e.r_id).HasName("PRIMARY");

            entity.Property(e => e.r_status).HasComment("0正常，1禁用");
        });

        modelBuilder.Entity<bs_client_role_menu>(entity =>
        {
            entity.HasKey(e => e.rm_id).HasName("PRIMARY");
        });

        modelBuilder.Entity<bs_client_role_power>(entity =>
        {
            entity.HasKey(e => e.rp_id).HasName("PRIMARY");
        });

        modelBuilder.Entity<bs_client_system_log>(entity =>
        {
            entity.HasKey(e => e.l_id).HasName("PRIMARY");

            entity.Property(e => e.l_c_guid).HasComment("租户");
            entity.Property(e => e.l_content).HasComment("操作内容");
            entity.Property(e => e.l_cu_name).HasComment("名字");
            entity.Property(e => e.l_ip).HasComment("ip");
            entity.Property(e => e.l_source).HasComment("来源");
            entity.Property(e => e.l_system).HasComment("系统");
        });

        modelBuilder.Entity<bs_client_user>(entity =>
        {
            entity.HasKey(e => e.cu_id).HasName("PRIMARY");

            entity.Property(e => e.cu_c_guid)
                .HasDefaultValueSql("'newid())'")
                .HasComment("关联client");
            entity.Property(e => e.cu_guid).HasDefaultValueSql("'newid())'");
            entity.Property(e => e.cu_power_type).HasComment("super超级,general普通");
            entity.Property(e => e.cu_status)
                .HasDefaultValueSql("'0'")
                .HasComment("0正常，1禁用");
        });

        modelBuilder.Entity<bs_client_user_dep>(entity =>
        {
            entity.HasKey(e => e.cud__id).HasName("PRIMARY");

            entity.Property(e => e.cud_type).HasComment("1直属部门 ,2兼管部门");
        });

        modelBuilder.Entity<bs_client_user_role>(entity =>
        {
            entity.HasKey(e => e.ur_id).HasName("PRIMARY");
        });

        modelBuilder.Entity<bs_language>(entity =>
        {
            entity.HasKey(e => e.l_id).HasName("PRIMARY");

            entity.Property(e => e.l_code).HasComment("编号");
            entity.Property(e => e.l_name).HasComment("语言名称");
            entity.Property(e => e.l_status).HasComment("0正常，1禁用");
        });

        modelBuilder.Entity<bs_language_config>(entity =>
        {
            entity.HasKey(e => e.c_id).HasName("PRIMARY");

            entity.Property(e => e.c_name).HasComment("语言名称");
        });

        modelBuilder.Entity<bs_language_config_item>(entity =>
        {
            entity.HasKey(e => e.ci_id).HasName("PRIMARY");

            entity.Property(e => e.ci_c_code).HasComment("编码");
            entity.Property(e => e.ci_content).HasComment("语言名称");
            entity.Property(e => e.ci_l_guid).HasComment("语言");
        });

        modelBuilder.Entity<bs_language_iot_product>(entity =>
        {
            entity.HasKey(e => e.lp_id).HasName("PRIMARY");

            entity.Property(e => e.lp_c_guid).HasComment("bs_language_config");
            entity.Property(e => e.lp_p_guid).HasComment("iot_product");
        });

        modelBuilder.Entity<bs_language_iot_product_item>(entity =>
        {
            entity.HasKey(e => e.lpi_id).HasName("PRIMARY");

            entity.Property(e => e.lpi_c_code).HasComment("编码");
            entity.Property(e => e.lpi_ci_content).HasComment("语言名称");
            entity.Property(e => e.lpi_l_guid).HasComment("语言");
        });

        modelBuilder.Entity<bs_language_product_alone>(entity =>
        {
            entity.HasKey(e => e.lp_id).HasName("PRIMARY");

            entity.Property(e => e.lp_guid).HasComment("bs_language_config");
            entity.Property(e => e.lp_p_guid).HasComment("iot_product");
            entity.Property(e => e.lp_type).HasComment("0独立库 200，1来自共公库1000");
        });

        modelBuilder.Entity<bs_language_product_item_alone>(entity =>
        {
            entity.HasKey(e => e.lpi_id).HasName("PRIMARY");

            entity.Property(e => e.lpi_content).HasComment("语言名称");
            entity.Property(e => e.lpi_l_guid).HasComment("语言");
        });

        modelBuilder.Entity<bs_manage_role>(entity =>
        {
            entity.HasKey(e => e.r_id).HasName("PRIMARY");

            entity.Property(e => e.r_status).HasComment("0正常，1禁用");
        });

        modelBuilder.Entity<bs_manage_role_menu>(entity =>
        {
            entity.HasKey(e => e.rm_id).HasName("PRIMARY");
        });

        modelBuilder.Entity<bs_manage_role_power>(entity =>
        {
            entity.HasKey(e => e.rp_id).HasName("PRIMARY");
        });

        modelBuilder.Entity<bs_manage_system_log>(entity =>
        {
            entity.HasKey(e => e.l_id).HasName("PRIMARY");

            entity.Property(e => e.l_c_guid).HasComment("租户");
            entity.Property(e => e.l_content).HasComment("操作内容");
            entity.Property(e => e.l_cu_name).HasComment("名字");
            entity.Property(e => e.l_ip).HasComment("ip");
            entity.Property(e => e.l_source).HasComment("来源");
            entity.Property(e => e.l_system).HasComment("系统");
        });

        modelBuilder.Entity<bs_manage_system_menu>(entity =>
        {
            entity.HasKey(e => e.menu_id).HasName("PRIMARY");

            entity.Property(e => e.menu_status).HasComment("0正常，-1停用");
        });

        modelBuilder.Entity<bs_manage_system_module>(entity =>
        {
            entity.HasKey(e => e.M_AutoId).HasName("PRIMARY");

            entity.Property(e => e.M_AutoId).ValueGeneratedNever();
            entity.Property(e => e.M_Code).HasComment("编码");
            entity.Property(e => e.M_Name).HasComment("模块名称");
            entity.Property(e => e.M_Order).HasComment("排序");
            entity.Property(e => e.M_Status).HasComment("1启用，0禁用");
        });

        modelBuilder.Entity<bs_manage_user_role>(entity =>
        {
            entity.HasKey(e => e.ur_id).HasName("PRIMARY");
        });

        modelBuilder.Entity<bs_system_config>(entity =>
        {
            entity.HasKey(e => e.c_id).HasName("PRIMARY");

            entity.Property(e => e.c_id).HasComment("自增ID");
        });

        modelBuilder.Entity<bs_system_oauth_access_token>(entity =>
        {
            entity.HasKey(e => e.st_autoid).HasName("PRIMARY");

            entity.Property(e => e.st_guid).HasDefaultValueSql("'newid())'");
            entity.Property(e => e.st_status).HasDefaultValueSql("'0'");
        });

        modelBuilder.Entity<bs_system_oauth_client>(entity =>
        {
            entity.HasKey(e => e.oc_autoid).HasName("PRIMARY");

            entity.Property(e => e.oc_access_token_validity_time).HasComment("设定客户端access_token有效时间值（单位秒）");
            entity.Property(e => e.oc_client_secret).HasComment("客户端访问的密码");
            entity.Property(e => e.oc_resource_ids)
                .HasDefaultValueSql("'newid())'")
                .HasComment("能访问的资源，哪个系统");
            entity.Property(e => e.oc_scope).HasComment("客户申请的权限范围，可选值包括read,write,trust,有多个权限范围用逗号（,）分隔");
            entity.Property(e => e.oc_status).HasDefaultValueSql("'0'");
            entity.Property(e => e.oc_web_server_redirect_uri).HasComment("在oauth流程中会检测查与注册时填写的redirect_uri是否一致");
        });

        modelBuilder.Entity<bs_system_oauth_grant>(entity =>
        {
            entity.HasKey(e => e.st_autoid).HasName("PRIMARY");

            entity.Property(e => e.st_guid).HasDefaultValueSql("'newid())'");
            entity.Property(e => e.st_status).HasDefaultValueSql("'0'");
        });

        modelBuilder.Entity<bs_system_oauth_refresh_token>(entity =>
        {
            entity.HasKey(e => e.st_autoid).HasName("PRIMARY");

            entity.Property(e => e.st_guid).HasDefaultValueSql("'newid())'");
            entity.Property(e => e.st_status).HasDefaultValueSql("'0'");
        });

        modelBuilder.Entity<iot_device>(entity =>
        {
            entity.HasKey(e => e.d_id).HasName("PRIMARY");

            entity.Property(e => e.d_channel).HasComment("设备通道");
            entity.Property(e => e.d_code).HasComment("设备编号");
            entity.Property(e => e.d_group_guid).HasComment("组别ID");
            entity.Property(e => e.d_gw_d_guid).HasComment("归属网关设备d_guid");
            entity.Property(e => e.d_is_template).HasComment("0手工添加，1是产品设计型号，2是批量产品");
            entity.Property(e => e.d_model_guid).HasComment("邦定设备类型iot_device_model");
            entity.Property(e => e.d_name).HasComment("内部名称");
            entity.Property(e => e.d_order)
                .HasDefaultValueSql("'0'")
                .HasComment("排序");
            entity.Property(e => e.d_p_guid).HasComment("绑定产品iot_device_product");
            entity.Property(e => e.d_p_model_no).HasComment("模板编号");
            entity.Property(e => e.d_parameter).HasComment("设备参数");
            entity.Property(e => e.d_parameter_init).HasComment("初始化");
            entity.Property(e => e.d_place_guid).HasComment("位置");
            entity.Property(e => e.d_register_address).HasComment("寄存器地址1-255");
            entity.Property(e => e.d_status)
                .HasDefaultValueSql("'0'")
                .HasComment("0启用，1禁用");
            entity.Property(e => e.d_visible).HasComment("0看得见，1看不见");
        });

        modelBuilder.Entity<iot_device_agreement>(entity =>
        {
            entity.HasKey(e => e.a_id).HasName("PRIMARY");

            entity.Property(e => e.a_name).HasDefaultValueSql("'0'");
            entity.Property(e => e.a_status).HasComment("0正常，1禁用");
        });

        modelBuilder.Entity<iot_device_camera>(entity =>
        {
            entity.HasKey(e => e.dc_autoid).HasName("PRIMARY");

            entity.Property(e => e.dc_guid).HasDefaultValueSql("'newid())'");
            entity.Property(e => e.dc_gw_guid).HasComment("绑定主机");
            entity.Property(e => e.dc_live_set_interval_time).HasComment("设置多久心跳一次 秒");
            entity.Property(e => e.dc_live_state)
                .HasDefaultValueSql("'0'")
                .HasComment("0未检测查，1正常，2异常");
            entity.Property(e => e.dc_live_state_set_time).HasComment("心跳时间");
            entity.Property(e => e.dc_order).HasDefaultValueSql("'0'");
            entity.Property(e => e.dc_user_name).HasComment("使用人");
        });

        modelBuilder.Entity<iot_device_command>(entity =>
        {
            entity.HasKey(e => e.dc_id).HasName("PRIMARY");

            entity.Property(e => e.dc_agreement_guid).HasComment("协议");
            entity.Property(e => e.dc_agreement_type).HasComment("协议");
            entity.Property(e => e.dc_content).HasComment("指令内容");
            entity.Property(e => e.dc_guid).HasDefaultValueSql("'newid())'");
            entity.Property(e => e.dc_key).HasComment("指令key");
            entity.Property(e => e.dc_key_type).HasComment("0一般指令可展示，1设备初始化配置参数 d_parameter_init");
            entity.Property(e => e.dc_model_guid).HasComment("型号");
            entity.Property(e => e.dc_name).HasComment("名称");
            entity.Property(e => e.dc_remark).HasComment("备注");
            entity.Property(e => e.dc_status)
                .HasDefaultValueSql("'0'")
                .HasComment("0正常，1禁用");
        });

        modelBuilder.Entity<iot_device_command_haddleing>(entity =>
        {
            entity.HasKey(e => e.l_id).HasName("PRIMARY");

            entity.Property(e => e.l_add_time)
                .ValueGeneratedOnAddOrUpdate()
                .HasDefaultValueSql("CURRENT_TIMESTAMP");
            entity.Property(e => e.l_agreement_type).HasComment("协议");
            entity.Property(e => e.l_content).HasComment("执行内容");
            entity.Property(e => e.l_d_guid).HasDefaultValueSql("'newid())'");
            entity.Property(e => e.l_device_model_code).HasComment("设备型号");
            entity.Property(e => e.l_gateway_code).HasComment("设备id");
            entity.Property(e => e.l_guid).HasDefaultValueSql("'newid())'");
            entity.Property(e => e.l_key).HasComment("执行key");
            entity.Property(e => e.l_name).HasComment("指令名称");
            entity.Property(e => e.l_parameter).HasComment("设备参数");
            entity.Property(e => e.l_repeat_count).HasComment("重复执行次数，0无限");
            entity.Property(e => e.l_repeat_count_interval).HasComment("毫秒，最大支持864000000，约10天");
            entity.Property(e => e.l_return_msg).HasComment("响应回传信息");
            entity.Property(e => e.l_return_time).HasComment("向应回传时间");
            entity.Property(e => e.l_source).HasComment("消息来源");
            entity.Property(e => e.l_status).HasComment("0待执行,1处理中，2回调成功，3异常,4已发送mq,5mq发送失败");
            entity.Property(e => e.l_user_name).HasComment("发送指令的人");
            entity.Property(e => e.l_user_remote_ip).HasComment("发送指令人的IP");
        });

        modelBuilder.Entity<iot_device_command_log>(entity =>
        {
            entity.HasKey(e => e.l_id).HasName("PRIMARY");

            entity.Property(e => e.l_add_time)
                .ValueGeneratedOnAddOrUpdate()
                .HasDefaultValueSql("CURRENT_TIMESTAMP");
            entity.Property(e => e.l_agreement_type).HasComment("协议");
            entity.Property(e => e.l_content).HasComment("执行内容");
            entity.Property(e => e.l_d_guid).HasDefaultValueSql("'newid())'");
            entity.Property(e => e.l_device_model_code).HasComment("设备型号");
            entity.Property(e => e.l_gateway_code).HasComment("设备id");
            entity.Property(e => e.l_guid).HasDefaultValueSql("'newid())'");
            entity.Property(e => e.l_key).HasComment("执行key");
            entity.Property(e => e.l_name).HasComment("指令名称");
            entity.Property(e => e.l_parameter).HasComment("设备参数");
            entity.Property(e => e.l_repeat_count).HasComment("重复执行次数，0无限");
            entity.Property(e => e.l_repeat_count_interval).HasComment("毫秒，最大支持864000000，约10天");
            entity.Property(e => e.l_return_msg).HasComment("响应回传信息");
            entity.Property(e => e.l_return_time).HasComment("向应回传时间");
            entity.Property(e => e.l_source).HasComment("消息来源");
            entity.Property(e => e.l_status).HasComment("0待执行,1处理中，2回调成功，3异常,4已发送mq,5mq发送失败");
            entity.Property(e => e.l_user_name).HasComment("发送指令的人");
            entity.Property(e => e.l_user_remote_ip).HasComment("发送指令人的IP");
        });

        modelBuilder.Entity<iot_device_command_processing>(entity =>
        {
            entity.HasKey(e => e.p_id).HasName("PRIMARY");

            entity.Property(e => e.p_add_time)
                .ValueGeneratedOnAddOrUpdate()
                .HasDefaultValueSql("CURRENT_TIMESTAMP");
            entity.Property(e => e.p_agreement_type).HasComment("协议");
            entity.Property(e => e.p_content).HasComment("执行内容");
            entity.Property(e => e.p_d_guid).HasDefaultValueSql("'newid())'");
            entity.Property(e => e.p_device_model_code).HasComment("设备型号");
            entity.Property(e => e.p_execute_time).HasComment("发送时间");
            entity.Property(e => e.p_gateway_code).HasComment("设备id");
            entity.Property(e => e.p_gateway_deviceguid).HasComment("网关设备ID");
            entity.Property(e => e.p_group_guid).HasComment("运行组");
            entity.Property(e => e.p_guid).HasDefaultValueSql("'newid())'");
            entity.Property(e => e.p_key).HasComment("执行key");
            entity.Property(e => e.p_name).HasComment("指令名称");
            entity.Property(e => e.p_parameter).HasComment("参数");
            entity.Property(e => e.p_repeat_count).HasComment("重复执行次数");
            entity.Property(e => e.p_repeat_count_interval).HasComment("毫秒，最大支持864000000，约10天");
            entity.Property(e => e.p_source).HasComment("来源");
            entity.Property(e => e.p_status).HasComment("0待执行,1处理中，2回调成功，3异常,4已发送mq,5mq发送失败");
            entity.Property(e => e.p_user_name).HasComment("发送指令的人");
            entity.Property(e => e.p_user_remote_ip).HasComment("发送指令人的IP");
        });

        modelBuilder.Entity<iot_device_gateway>(entity =>
        {
            entity.HasKey(e => new { e.gw_id, e.gw_code })
                .HasName("PRIMARY")
                .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 });

            entity.Property(e => e.gw_id).ValueGeneratedOnAdd();
            entity.Property(e => e.gw_code).HasComment("init/devicecode.txt配置");
            entity.Property(e => e.gw_cpu_temperature).HasComment("cpu温度");
            entity.Property(e => e.gw_deviceid).HasComment("设备id");
            entity.Property(e => e.gw_gpu_temperature).HasComment("gpu温度");
            entity.Property(e => e.gw_guid).HasDefaultValueSql("'newid())'");
            entity.Property(e => e.gw_key).HasComment("密钥key");
            entity.Property(e => e.gw_live_set_interval_time)
                .HasDefaultValueSql("'60000'")
                .HasComment("设定查询状态时间 秒");
            entity.Property(e => e.gw_live_state)
                .HasDefaultValueSql("'0'")
                .HasComment("0未知，1正常，2异常");
            entity.Property(e => e.gw_live_time).HasComment("最近活跃时间");
            entity.Property(e => e.gw_machine_model).HasComment("机器型号");
            entity.Property(e => e.gw_machine_name).HasComment("机器型号");
            entity.Property(e => e.gw_memory_empty).HasComment("空余内存");
            entity.Property(e => e.gw_memory_total).HasComment("总内存");
            entity.Property(e => e.gw_memory_use).HasComment("已使用内存");
            entity.Property(e => e.gw_software_version).HasComment("软件版本号");
            entity.Property(e => e.gw_start_time).HasComment("机子启动时间");
            entity.Property(e => e.gw_system).HasComment("操作系统");
            entity.Property(e => e.gw_system_login_info).HasComment("系统登录信息");
        });

        modelBuilder.Entity<iot_device_group>(entity =>
        {
            entity.HasKey(e => e.g_id).HasName("PRIMARY");

            entity.Property(e => e.g_name).HasDefaultValueSql("'0'");
            entity.Property(e => e.g_status).HasComment("0正常，1禁用");
        });

        modelBuilder.Entity<iot_device_linkage>(entity =>
        {
            entity.HasKey(e => e.l_id).HasName("PRIMARY");

            entity.ToTable(tb => tb.HasComment("设备"));

            entity.Property(e => e.l_auto_run).HasComment("0启动，1不启动");
            entity.Property(e => e.l_auto_run_join).HasComment("0不参与自动配置，1参与自动配置");
            entity.Property(e => e.l_c_guid).HasComment("client");
            entity.Property(e => e.l_condition_type).HasComment("条件类型and,or");
            entity.Property(e => e.l_cu_guid).HasComment("用户名");
            entity.Property(e => e.l_execute_result).HasComment("执行结果说明");
            entity.Property(e => e.l_execute_time).HasComment("最近执行时间");
            entity.Property(e => e.l_execute_type).HasComment("0自动执行，1手工调用执行,2Fast单通道执行");
            entity.Property(e => e.l_is_template).HasComment("0否，1是产品型号,2由模板生成的产品");
            entity.Property(e => e.l_p_guid).HasComment("产品iot_device_product");
            entity.Property(e => e.l_p_model_no).HasComment("产品序号");
            entity.Property(e => e.l_status).HasComment("0正常，1无效");
        });

        modelBuilder.Entity<iot_device_linkage_condition>(entity =>
        {
            entity.HasKey(e => e.lc_id).HasName("PRIMARY");

            entity.ToTable(tb => tb.HasComment("设备"));

            entity.Property(e => e.lc_d_guid).HasComment("设备ID");
            entity.Property(e => e.lc_dc_guid).HasComment("iot_device_command");
            entity.Property(e => e.lc_dv_guid).HasComment("iot_device_variable");
            entity.Property(e => e.lc_group1).HasComment("组");
            entity.Property(e => e.lc_key).HasComment("执行key");
            entity.Property(e => e.lc_l_guid).HasComment("绑定iot_device_linkage");
            entity.Property(e => e.lc_operation).HasComment("联动类型main,follow");
            entity.Property(e => e.lc_order).HasComment("执行排序");
            entity.Property(e => e.lc_p_model_no).HasComment("产品型号编码");
            entity.Property(e => e.lc_repeat_count).HasComment("运行重复次数");
            entity.Property(e => e.lc_repeat_interval).HasComment("每隔秒执行一次");
            entity.Property(e => e.lc_status).HasComment("0启用，1禁用");
            entity.Property(e => e.lc_status_modtime).HasComment("状态修改时间");
            entity.Property(e => e.lc_value).HasComment("执行内容");
            entity.Property(e => e.lc_value_rule).HasComment("执行内容规则,大于，小于，等于><=");
            entity.Property(e => e.lc_vr_guid).HasComment("网关ID");
        });

        modelBuilder.Entity<iot_device_linkage_condition_handle>(entity =>
        {
            entity.HasKey(e => e.lc_id).HasName("PRIMARY");

            entity.ToTable(tb => tb.HasComment("设备"));

            entity.Property(e => e.lc_d_guid).HasComment("设备ID");
            entity.Property(e => e.lc_dc_guid).HasComment("iot_device_command");
            entity.Property(e => e.lc_dv_guid).HasComment("iot_device_variable");
            entity.Property(e => e.lc_group1).HasComment("组");
            entity.Property(e => e.lc_key).HasComment("执行key");
            entity.Property(e => e.lc_l_guid).HasComment("绑定iot_device_linkage");
            entity.Property(e => e.lc_order).HasComment("执行排序");
            entity.Property(e => e.lc_status).HasComment("0启用，1禁用");
            entity.Property(e => e.lc_status_modtime).HasComment("状态修改时间");
            entity.Property(e => e.lc_value).HasComment("执行内容");
            entity.Property(e => e.lc_value_rule).HasComment("执行内容规则,大于，小于，等于><=");
            entity.Property(e => e.lc_vr_guid).HasComment("网关ID");
        });

        modelBuilder.Entity<iot_device_linkage_condition_log>(entity =>
        {
            entity.HasKey(e => e.l_id).HasName("PRIMARY");

            entity.ToTable(tb => tb.HasComment("设备"));

            entity.Property(e => e.l_l_guid).HasComment("iot_device_linkage");
            entity.Property(e => e.l_lc_guid).HasComment("iot_device_linkage_condition");
        });

        modelBuilder.Entity<iot_device_linkage_condition_model_support>(entity =>
        {
            entity.HasKey(e => e.cms_id).HasName("PRIMARY");

            entity.ToTable(tb => tb.HasComment("设备"));

            entity.Property(e => e.cms_mode_code).HasComment("型号编码");
        });

        modelBuilder.Entity<iot_device_linkage_execute_record>(entity =>
        {
            entity.HasKey(e => e.ec_id).HasName("PRIMARY");

            entity.ToTable(tb => tb.HasComment("设备"));

            entity.Property(e => e.ec_add_time).HasDefaultValueSql("CURRENT_TIMESTAMP");
            entity.Property(e => e.ec_d_guid).HasComment("设备ID");
            entity.Property(e => e.ec_execute_lock_code).HasComment("执行批次编号，避免被多个线程取值");
            entity.Property(e => e.ec_execute_type).HasComment("0自动运行，1手动运行");
            entity.Property(e => e.ec_l_guid).HasComment("iot_device_linkage");
        });

        modelBuilder.Entity<iot_device_live_state>(entity =>
        {
            entity.HasKey(e => new { e.ls_id, e.ls_d_guid })
                .HasName("PRIMARY")
                .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 });

            entity.ToTable(tb => tb.HasComment("设备状态 正常、异常"));

            entity.Property(e => e.ls_id).ValueGeneratedOnAdd();
            entity.Property(e => e.ls_d_guid).HasComment("设备iot_device");
            entity.Property(e => e.ls_live_state).HasComment("状态0未知待检测状态，1正常，2异常,3检测状态中，100打开，101关闭',");
            entity.Property(e => e.ls_live_state_remark).HasComment("状态备注");
            entity.Property(e => e.ls_live_state_set_time).HasComment("状态更新时间");
            entity.Property(e => e.ls_response_state).HasComment("连接通讯状态，0正常，1不正常");
            entity.Property(e => e.ls_unresponse_time).HasComment("断连时间");
        });

        modelBuilder.Entity<iot_device_logo>(entity =>
        {
            entity.HasKey(e => e.df_id).HasName("PRIMARY");

            entity.ToTable(tb => tb.HasComment("设备LOGO"));

            entity.Property(e => e.df_d_guid).HasComment("设备id");
            entity.Property(e => e.df_url).HasComment("LOGO地址");
        });

        modelBuilder.Entity<iot_device_minimachinecommand_log>(entity =>
        {
            entity.HasKey(e => e.c_id).HasName("PRIMARY");

            entity.Property(e => e.c_command).HasComment("指令");
            entity.Property(e => e.c_guid).HasDefaultValueSql("'newid())'");
            entity.Property(e => e.c_gw_code).HasComment("iot_device_gateway code");
            entity.Property(e => e.c_gw_guid).HasComment("0已发送，2已回复");
            entity.Property(e => e.c_return_code).HasComment("返回码");
            entity.Property(e => e.c_return_msg).HasComment("返回响应信息");
        });

        modelBuilder.Entity<iot_device_model>(entity =>
        {
            entity.HasKey(e => e.m_id).HasName("PRIMARY");

            entity.Property(e => e.m_agreementType).HasComment("协议名称");
            entity.Property(e => e.m_agreement_guid).HasComment("协议ID");
            entity.Property(e => e.m_attribute)
                .HasDefaultValueSql("'0'")
                .HasComment("1执行器，2传感器，3网关,4延时，模拟，5显示");
            entity.Property(e => e.m_brand).HasComment("品牌");
            entity.Property(e => e.m_buy_from).HasComment("买来源");
            entity.Property(e => e.m_c_guid).HasComment("客户");
            entity.Property(e => e.m_code).HasComment("设备型号编号，很重要，代码里判断设备型号");
            entity.Property(e => e.m_command_explain).HasComment("指令解说");
            entity.Property(e => e.m_name).HasComment("类型名称");
            entity.Property(e => e.m_parameter_demo).HasComment("参数模板");
            entity.Property(e => e.m_parameter_demo_init).HasComment("初始化");
            entity.Property(e => e.m_remark).HasComment("备注");
            entity.Property(e => e.m_status).HasComment("0正常，1禁用");
            entity.Property(e => e.m_supply_from).HasComment("供应商");
            entity.Property(e => e.m_type_guid).HasComment("iot_device_model_Type");
            entity.Property(e => e.m_value_remark).HasComment("数据值说明备注");
        });

        modelBuilder.Entity<iot_device_model_file>(entity =>
        {
            entity.HasKey(e => e.f_id).HasName("PRIMARY");

            entity.Property(e => e.f_extension).HasComment("文件类型");
            entity.Property(e => e.f_filename).HasComment("文件名");
            entity.Property(e => e.f_guid).HasComment("设备型号编号，很重要，代码里判断设备型号");
            entity.Property(e => e.f_m_guid).HasComment("iot_device_model");
            entity.Property(e => e.f_path)
                .HasDefaultValueSql("'0'")
                .HasComment("目录");
            entity.Property(e => e.f_type).HasComment("logo,info，file");
            entity.Property(e => e.f_url).HasComment("访问地址");
        });

        modelBuilder.Entity<iot_device_model_type>(entity =>
        {
            entity.HasKey(e => e.t_id).HasName("PRIMARY");

            entity.Property(e => e.t_name).HasComment("类型名称");
            entity.Property(e => e.t_status)
                .HasDefaultValueSql("'0'")
                .HasComment("0正常，1禁用");
        });

        modelBuilder.Entity<iot_device_model_variable>(entity =>
        {
            entity.HasKey(e => e.v_id).HasName("PRIMARY");

            entity.ToTable(tb => tb.HasComment("设备变量，根据传感器上传的值变量，把变量名字填入这个表里面"));

            entity.Property(e => e.v_add_time)
                .ValueGeneratedOnAddOrUpdate()
                .HasDefaultValueSql("CURRENT_TIMESTAMP");
            entity.Property(e => e.v_export).HasComment("0可上传数据值，1可执指令");
            entity.Property(e => e.v_guid).HasDefaultValueSql("'newid())'");
            entity.Property(e => e.v_key).HasComment("值key");
            entity.Property(e => e.v_order).HasComment("排序");
            entity.Property(e => e.v_remark).HasComment("说明");
            entity.Property(e => e.v_status).HasComment("0有效，1无效");
            entity.Property(e => e.v_unit).HasComment("数值单位");
            entity.Property(e => e.v_value_type).HasComment("number/string/bool值类型");
        });

        modelBuilder.Entity<iot_device_model_variable_relation>(entity =>
        {
            entity.HasKey(e => e.mv_id).HasName("PRIMARY");

            entity.ToTable(tb => tb.HasComment("设备变量，根据传感器上传的值变量，把变量名字填入这个表里面"));

            entity.Property(e => e.mv_add_time)
                .ValueGeneratedOnAddOrUpdate()
                .HasDefaultValueSql("CURRENT_TIMESTAMP");
            entity.Property(e => e.mv_limit).HasComment("属性值范围");
            entity.Property(e => e.mv_model_guid).HasDefaultValueSql("'newid())'");
            entity.Property(e => e.mv_order).HasComment("排序");
            entity.Property(e => e.mv_remark).HasComment("说明");
            entity.Property(e => e.mv_v_guid).HasDefaultValueSql("'newid())'");
        });

        modelBuilder.Entity<iot_device_model_variable_value_rlue>(entity =>
        {
            entity.HasKey(e => e.vr_id).HasName("PRIMARY");

            entity.Property(e => e.vr_add_time)
                .ValueGeneratedOnAddOrUpdate()
                .HasDefaultValueSql("CURRENT_TIMESTAMP");
            entity.Property(e => e.vr_guid).HasDefaultValueSql("'newid())'");
            entity.Property(e => e.vr_key).HasComment("变量key");
            entity.Property(e => e.vr_remark).HasComment("说明");
            entity.Property(e => e.vr_rule).HasComment("规则");
            entity.Property(e => e.vr_status).HasComment("0有效，1无效");
            entity.Property(e => e.vr_type).HasComment("值key");
        });

        modelBuilder.Entity<iot_device_software>(entity =>
        {
            entity.HasKey(e => e.sw_id).HasName("PRIMARY");

            entity.Property(e => e.sw_command).HasComment("指令");
            entity.Property(e => e.sw_guid).HasDefaultValueSql("'newid())'");
            entity.Property(e => e.sw_gw_guid).HasComment("绑定主机");
            entity.Property(e => e.sw_packages_url).HasComment("升级包地址");
            entity.Property(e => e.sw_return_msg).HasComment("升级响应");
            entity.Property(e => e.sw_service_name).HasComment("服务名");
            entity.Property(e => e.sw_status)
                .HasDefaultValueSql("'0'")
                .HasComment("0待处理，1处理中，2正常完成，3异常");
            entity.Property(e => e.sw_swp_guid).HasComment("绑定iot_device_software_publish");
            entity.Property(e => e.sw_version)
                .HasDefaultValueSql("'1'")
                .HasComment("版本号");
        });

        modelBuilder.Entity<iot_device_software_publish>(entity =>
        {
            entity.HasKey(e => e.swp_id).HasName("PRIMARY");

            entity.Property(e => e.swp_guid).HasDefaultValueSql("'newid())'");
            entity.Property(e => e.swp_status)
                .HasDefaultValueSql("'0'")
                .HasComment("0正常，1已过期");
            entity.Property(e => e.swp_version)
                .HasDefaultValueSql("'1'")
                .HasComment("版本号");
        });

        modelBuilder.Entity<iot_device_task_default_run>(entity =>
        {
            entity.HasKey(e => e.dr_id).HasName("PRIMARY");

            entity.ToTable(tb => tb.HasComment("设备"));

            entity.Property(e => e.dr_auto_run).HasComment("0启动，1不启动");
            entity.Property(e => e.dr_auto_run_jion).HasComment("0不参与自动配置，1参与自动配置");
            entity.Property(e => e.dr_c_guid).HasComment(" 客户");
            entity.Property(e => e.dr_complete)
                .HasDefaultValueSql("'0'")
                .HasComment("0未执行，1已执行");
            entity.Property(e => e.dr_d_guid).HasComment("设备id");
            entity.Property(e => e.dr_execute_count)
                .HasDefaultValueSql("'0'")
                .HasComment("已执行次数");
            entity.Property(e => e.dr_execute_time).HasComment("上次执行时间");
            entity.Property(e => e.dr_interval_name).HasComment("名称");
            entity.Property(e => e.dr_interval_unit).HasComment("单位ss,mm,hh");
            entity.Property(e => e.dr_interval_value).HasComment("数值");
            entity.Property(e => e.dr_is_template).HasComment("0非模板，1模板");
            entity.Property(e => e.dr_key).HasComment("iot_device_command");
            entity.Property(e => e.dr_p_guid).HasComment("产品ID");
            entity.Property(e => e.dr_p_model_no).HasComment("产品编号");
            entity.Property(e => e.dr_repeat_count).HasComment("重复0无限次，1 一次");
            entity.Property(e => e.dr_start_time).HasComment("数值ss,0为不设置值");
            entity.Property(e => e.dr_status).HasComment("0正常，1无效");
            entity.Property(e => e.dr_title).HasComment("标题");
        });

        modelBuilder.Entity<iot_device_task_plain>(entity =>
        {
            entity.HasKey(e => e.tp_id).HasName("PRIMARY");

            entity.ToTable(tb => tb.HasComment("设备"));

            entity.Property(e => e.tp_auto_run).HasComment("0启动，1不启动");
            entity.Property(e => e.tp_auto_run_join).HasComment("0不参与自动配置，1参与自动配置");
            entity.Property(e => e.tp_complete).HasComment("0未完成，1已完成");
            entity.Property(e => e.tp_complete_time).HasComment("完成时间");
            entity.Property(e => e.tp_execute_batch_no).HasComment("运行批次");
            entity.Property(e => e.tp_execute_time).HasComment("运行时间");
            entity.Property(e => e.tp_is_template).HasComment("0否，1是产品型号,2由模板生成的产品");
            entity.Property(e => e.tp_p_guid).HasComment("产品iot_device_product");
            entity.Property(e => e.tp_p_model_no).HasComment("产品序号");
            entity.Property(e => e.tp_set_live_time).HasComment("处理中时间，tp_complete=0时，1分钟内在线视为处理中");
            entity.Property(e => e.tp_status).HasComment("0正常，1无效");
            entity.Property(e => e.tp_title).HasComment("标题");
        });

        modelBuilder.Entity<iot_device_task_plain_item>(entity =>
        {
            entity.HasKey(e => e.tpi_id).HasName("PRIMARY");

            entity.ToTable(tb => tb.HasComment("设备"));

            entity.Property(e => e.tpi_complete).HasComment("0未完成，1已完成");
            entity.Property(e => e.tpi_complete_time).HasComment("完成时间");
            entity.Property(e => e.tpi_delayed_value1).HasComment("延时ss");
            entity.Property(e => e.tpi_execute_batch_no).HasComment("运行批次号");
            entity.Property(e => e.tpi_execute_delayed_time).HasComment("延时触发时间");
            entity.Property(e => e.tpi_execute_time).HasComment("运行时间");
            entity.Property(e => e.tpi_key).HasComment("指令key iot_device_variable");
            entity.Property(e => e.tpi_object_guid).HasComment("处理结果guid");
            entity.Property(e => e.tpi_object_type).HasComment("处理结果类型");
            entity.Property(e => e.tpi_order).HasComment("顺序");
            entity.Property(e => e.tpi_p_model_no).HasComment("模板编码");
            entity.Property(e => e.tpi_repeat_count).HasComment("执行次数，不会等待 -1无限次，-100停止");
            entity.Property(e => e.tpi_repeat_interval).HasComment("每隔秒执行一次");
            entity.Property(e => e.tpi_status).HasComment("0正常，1无效");
            entity.Property(e => e.tpi_taskobj_guid).HasComment("设备ID");
            entity.Property(e => e.tpi_title).HasComment("标题");
            entity.Property(e => e.tpi_tp_guid).HasComment("条件iot_device_task_plain");
            entity.Property(e => e.tpi_type).HasComment("0指令，1条件,100延时(废弃),2(废弃)条件成立，否则执行条件tpi_object_guid,3设备主动上传数据");
            entity.Property(e => e.tpi_value).HasComment("值");
            entity.Property(e => e.tpi_value_rlue).HasComment("值>  =或<");
        });

        modelBuilder.Entity<iot_device_task_plain_item_handle>(entity =>
        {
            entity.HasKey(e => e.tpi_id).HasName("PRIMARY");

            entity.ToTable(tb => tb.HasComment("设备"));

            entity.Property(e => e.tpi_id).ValueGeneratedNever();
            entity.Property(e => e.tpi_complete).HasComment("0未完成，1已完成");
            entity.Property(e => e.tpi_execute_batch_no).HasComment("运行批次号");
            entity.Property(e => e.tpi_execute_delayed_time).HasComment("延时触发时间");
            entity.Property(e => e.tpi_execute_time).HasComment("运行时间");
            entity.Property(e => e.tpi_key).HasComment("指令key iot_device_variable");
            entity.Property(e => e.tpi_order).HasComment("顺序");
            entity.Property(e => e.tpi_repeat_count).HasComment("执行次数，不会等待 -1无限次，-100停止");
            entity.Property(e => e.tpi_repeat_interval).HasComment("每隔秒执行一次");
            entity.Property(e => e.tpi_status).HasComment("0正常，1无效");
            entity.Property(e => e.tpi_taskobj_guid).HasComment("设备ID");
            entity.Property(e => e.tpi_title).HasComment("标题");
            entity.Property(e => e.tpi_tp_guid).HasComment("条件iot_device_task_plain");
            entity.Property(e => e.tpi_type).HasComment("0指令，1条件,100延时,2条件成立，否则执行条件tpi_object_guid,3设备主动上传数据");
            entity.Property(e => e.tpi_value).HasComment("值");
            entity.Property(e => e.tpi_value_rlue).HasComment("值>  =或<");
        });

        modelBuilder.Entity<iot_device_task_plain_item_log>(entity =>
        {
            entity.HasKey(e => e.li_id).HasName("PRIMARY");

            entity.ToTable(tb => tb.HasComment("设备"));

            entity.Property(e => e.li_execute_batch_no).HasComment("执行批次");
            entity.Property(e => e.li_remark).HasComment("备注");
            entity.Property(e => e.li_status).HasComment("0正常，1失败");
            entity.Property(e => e.li_title).HasComment("标题");
        });

        modelBuilder.Entity<iot_device_task_plain_log>(entity =>
        {
            entity.HasKey(e => e.l_id).HasName("PRIMARY");

            entity.ToTable(tb => tb.HasComment("设备"));

            entity.Property(e => e.l_execute_batch_no).HasComment("执行批次");
            entity.Property(e => e.l_remark).HasComment("备注");
            entity.Property(e => e.l_status).HasComment("0正常，1失败");
            entity.Property(e => e.l_title).HasComment("标题");
        });

        modelBuilder.Entity<iot_device_task_time_fixed>(entity =>
        {
            entity.HasKey(e => e.tf_id).HasName("PRIMARY");

            entity.ToTable(tb => tb.HasComment("设备"));

            entity.Property(e => e.tf_auto_run).HasComment("0启动，1不启动");
            entity.Property(e => e.tf_auto_run_jion).HasComment("0不参与自动配置，1参与自动配置");
            entity.Property(e => e.tf_execute_count).HasComment("执行次数");
            entity.Property(e => e.tf_execute_time).HasComment("上次执行时间,默认值2000-01-01 00:00:00");
            entity.Property(e => e.tf_interval_day).HasComment("0每天到点执行,1-每隔1天一次，2-每隔2天一次，每隔几日运行一次");
            entity.Property(e => e.tf_is_template).HasComment("0非模板，1模板");
            entity.Property(e => e.tf_key).HasComment("iot_device_command");
            entity.Property(e => e.tf_p_guid).HasComment("产品");
            entity.Property(e => e.tf_p_model_no).HasComment("产品编号");
            entity.Property(e => e.tf_start_time).HasComment("数值ss,0为不设置值");
            entity.Property(e => e.tf_status).HasComment("0正常，1无效");
            entity.Property(e => e.tf_task_guid).HasComment("设备id");
            entity.Property(e => e.tf_task_type).HasComment("任务类型");
            entity.Property(e => e.tf_time_name).HasComment("名称");
            entity.Property(e => e.tf_time_value).HasComment("几点钟执行");
            entity.Property(e => e.tf_title).HasComment("标题");
            entity.Property(e => e.tf_value).HasComment("iot_device_command");
        });

        modelBuilder.Entity<iot_device_task_time_fixed_log>(entity =>
        {
            entity.HasKey(e => e.l_id).HasName("PRIMARY");

            entity.ToTable(tb => tb.HasComment("设备"));

            entity.Property(e => e.l_tf_guid).HasComment("设备id");
        });

        modelBuilder.Entity<iot_device_task_time_interval>(entity =>
        {
            entity.HasKey(e => e.ti_id).HasName("PRIMARY");

            entity.ToTable(tb => tb.HasComment("设备"));

            entity.Property(e => e.ti_auto_run).HasComment("0启动，1不启动");
            entity.Property(e => e.ti_auto_run_jion).HasComment("0不参与自动配置，1参与自动配置");
            entity.Property(e => e.ti_c_guid).HasComment("客户");
            entity.Property(e => e.ti_execute_count).HasComment("执行次数");
            entity.Property(e => e.ti_execute_time).HasComment("上次执行时间，默认值2000-01-01 00:00:00");
            entity.Property(e => e.ti_interval_name).HasComment("名称");
            entity.Property(e => e.ti_interval_unit).HasComment("单位ss,mm,hh");
            entity.Property(e => e.ti_interval_value).HasComment("数值");
            entity.Property(e => e.ti_is_template).HasComment("0非模板，1模板");
            entity.Property(e => e.ti_key).HasComment("iot_device_command");
            entity.Property(e => e.ti_p_guid).HasComment("产品iot_product");
            entity.Property(e => e.ti_p_model_no).HasComment("编号");
            entity.Property(e => e.ti_start_time).HasComment("数值ss,0为不设置值");
            entity.Property(e => e.ti_status).HasComment("0正常，1无效");
            entity.Property(e => e.ti_task_guid).HasComment("设备id");
            entity.Property(e => e.ti_task_type).HasComment("任务类型");
            entity.Property(e => e.ti_title).HasComment("标题");
            entity.Property(e => e.ti_value).HasComment("iot_device_command");
        });

        modelBuilder.Entity<iot_device_task_time_interval_log>(entity =>
        {
            entity.HasKey(e => e.l_id).HasName("PRIMARY");

            entity.ToTable(tb => tb.HasComment("设备"));

            entity.Property(e => e.l_ti_guid).HasComment("设备id");
        });

        modelBuilder.Entity<iot_device_value_current>(entity =>
        {
            entity.HasKey(e => e.vc_id).HasName("PRIMARY");

            entity.ToTable(tb => tb.HasComment("设备最新值"));

            entity.Property(e => e.vc_d_guid).HasDefaultValueSql("'newid())'");
            entity.Property(e => e.vc_guid).HasDefaultValueSql("'newid())'");
            entity.Property(e => e.vc_key).HasComment("值key");
            entity.Property(e => e.vc_name).HasComment("名称");
            entity.Property(e => e.vc_remark).HasComment("说明");
            entity.Property(e => e.vc_value).HasComment("值value");
        });

        modelBuilder.Entity<iot_device_value_log>(entity =>
        {
            entity.HasKey(e => e.vl_id).HasName("PRIMARY");

            entity.Property(e => e.vl_add_time)
                .ValueGeneratedOnAddOrUpdate()
                .HasDefaultValueSql("CURRENT_TIMESTAMP");
            entity.Property(e => e.vl_key).HasComment("值key");
            entity.Property(e => e.vl_name).HasComment("名称");
            entity.Property(e => e.vl_remark).HasComment("说明");
            entity.Property(e => e.vl_value).HasComment("值value");
        });

        modelBuilder.Entity<iot_mq_client>(entity =>
        {
            entity.HasKey(e => e.c_id).HasName("PRIMARY");

            entity.Property(e => e.c_client_id).HasComment("客户id");
            entity.Property(e => e.c_off_time).HasComment("下线时间");
            entity.Property(e => e.c_on_time).HasComment("上线时间");
            entity.Property(e => e.c_online)
                .HasDefaultValueSql("'0'")
                .HasComment("0在线，1下线");
            entity.Property(e => e.c_status).HasComment("0有效，1禁用");
            entity.Property(e => e.c_topic).HasComment("主题");
        });

        modelBuilder.Entity<iot_mq_log>(entity =>
        {
            entity.HasKey(e => e.ml_id).HasName("PRIMARY");

            entity.Property(e => e.ml_content).HasComment("内容");
            entity.Property(e => e.ml_guid).HasDefaultValueSql("'newid())'");
            entity.Property(e => e.ml_gw_d_guid).HasComment("设备ID");
            entity.Property(e => e.ml_mqevent).HasComment("消息事项名称");
            entity.Property(e => e.ml_result).HasComment("true/false");
            entity.Property(e => e.ml_type).HasComment("类型 send/receive");
        });

        modelBuilder.Entity<iot_product>(entity =>
        {
            entity.HasKey(e => e.p_id).HasName("PRIMARY");

            entity.Property(e => e.p_c_guid).HasComment("客户");
            entity.Property(e => e.p_check_code).HasComment("校验码");
            entity.Property(e => e.p_name).HasComment("类型名称");
            entity.Property(e => e.p_pm_guid).HasComment("产品型号");
            entity.Property(e => e.p_remark).HasComment("备注");
            entity.Property(e => e.p_scene_name).HasComment("场景名称");
            entity.Property(e => e.p_status)
                .HasDefaultValueSql("'0'")
                .HasComment("0正常，1禁用");
        });

        modelBuilder.Entity<iot_product_model>(entity =>
        {
            entity.HasKey(e => e.pm_id).HasName("PRIMARY");

            entity.Property(e => e.pm_c_guid).HasComment("客户");
            entity.Property(e => e.pm_code).HasComment("编码");
            entity.Property(e => e.pm_name).HasComment("型号名称");
            entity.Property(e => e.pm_p_guid).HasComment("记录生成型号模板的样版产品ID");
            entity.Property(e => e.pm_remark).HasComment("备注");
            entity.Property(e => e.pm_status)
                .HasDefaultValueSql("'0'")
                .HasComment("0正常，1禁用");
        });

        modelBuilder.Entity<iot_product_state>(entity =>
        {
            entity.HasKey(e => e.ps_id).HasName("PRIMARY");

            entity.Property(e => e.ps_cu_guid).HasComment("客户");
            entity.Property(e => e.ps_p_guid).HasComment("类型名称");
            entity.Property(e => e.ps_remark).HasComment("备注");
            entity.Property(e => e.ps_status).HasComment("1停止，0启动");
        });

        modelBuilder.Entity<iot_system_error_log>(entity =>
        {
            entity.HasKey(e => e.l_id).HasName("PRIMARY");

            entity.Property(e => e.l_c_guid).HasComment("租户");
            entity.Property(e => e.l_cu_guid).HasComment("用户");
            entity.Property(e => e.l_d_guid).HasDefaultValueSql("'newid())'");
            entity.Property(e => e.l_guid).HasDefaultValueSql("'newid())'");
            entity.Property(e => e.l_key).HasComment("key");
            entity.Property(e => e.l_msg).HasComment("响应回传信息");
            entity.Property(e => e.l_time).HasComment("向应回传时间");
            entity.Property(e => e.l_type).HasComment("ok,error");
        });

        modelBuilder.Entity<iot_warn_log>(entity =>
        {
            entity.HasKey(e => e.wl_id).HasName("PRIMARY");

            entity.ToTable(tb => tb.HasComment("警告"));

            entity.Property(e => e.wl_d_guid).HasComment("设备ID");
            entity.Property(e => e.wl_key).HasComment("值 key");
            entity.Property(e => e.wl_key_name).HasComment("名称");
            entity.Property(e => e.wl_remark).HasComment("备注");
            entity.Property(e => e.wl_value).HasComment("值value");
            entity.Property(e => e.wl_warn_status).HasComment("0非预警，1预警");
        });

        OnModelCreatingPartial(modelBuilder);
    }

    partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
}
